package com.yun.springbootsecurity.mapper;

import com.yun.springbootsecurity.pojo.Permission;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

@Mapper
public interface PermissionMapper {

    @Select("select * from t_permission where permission_id = #{permissionId}")
    @Results({
            @Result(id = true, column = "permission_id", property = "permissionId"),
            @Result(column = "permission_id", property = "resourePermissionList",
            many = @Many(select = "com.yun.springbootsecurity.mapper.ResourePermissionMapper.getResourePermissionByPermissionId",
            fetchType = FetchType.LAZY))
    })
    Permission selectByPermissionId(String permissionId);
}
